
# GET /user
get '/user' do
  google_login_require
  erb :'user/edit.html', :layout => :'layouts/user.html'
end

# POST /user
post '/user' do
  google_login_require
  @user.password = params[:password]
  
  begin
    @user.save
  rescue => e
    @logger.error 'in /user: failed transaction: ' + e.inspect
    @logger.error 'back trace: ' + e.backtrace.join("\n")
    @flash[:error] = 'パスワード保存中に障害が発生しました'
    erb :'user/edit.html', :layout => :'layouts/user.html'
  else
    @flash[:notice] = 'パスワードを変更しました'
    erb :'user/edit.html', :layout => :'layouts/user.html'
  end
end

